//商家列表
let express = require('express');
let path = require('path');
//引入自定义模块
let user = require('../model/user');
let order = require('../model/order');
let seller = require('../model/seller');

var router = express.Router();


router.get('/',function(req,res,next){
    res.sendStatus(404);
    //_dirname:当前文件的路径，path.join():合并路径
});
/**
 *登录验证功能
 */
router.post('/',function(req,res) {
    let cla =  req.body.class;
    if(cla == 'all'){
        seller.All(function (arr){
            if(arr.length === 0){
                res.send({sellerListStatus:1});
            }
            else
                res.send(JSON.parse('{"sellerListStatus":0,"sellerList":['+arr+']}'));
        })
    }
    else {
        seller.all(cla,function (arr){
            if(arr.length === 0){
                res.send({sellerListStatus:1});
            }
            else
                res.send(JSON.parse('{"sellerListStatus":0,"sellerList":['+arr+']}'));
        })
    }
})

module.exports = router;